import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Random;

/**
 * 
 * @author Pietro Bua & Rohmin Mirza
 *
 */
public class RandomFileGenerator
{
	
	/**
	 * 
	 * @param amountOfElements
	 * @param fileName
	 */
	public void generateFile(int amountOfElements, String fileName)
	{
		try 
		{
			BufferedWriter bw = new BufferedWriter(new FileWriter(new File(fileName)));
			Random randomGenerator = new Random();
			for (int i =0; i< amountOfElements; i++)
			{
				bw.write(Integer.toString(randomGenerator.nextInt(300)));
				bw.newLine();
			}
			bw.close();
		} 
		catch (IOException e) 
		{
			e.printStackTrace();
		}
		
	}
	
	/**
	 * 
	 * @param amountOfElements
	 * @return
	 */
	public int[] generateInputArray(int amountOfElements)
	{
		Random randomGenerator = new Random();
		int[] input = new int[amountOfElements];
		for (int i=0; i< amountOfElements; i++)
		{
			input[i]= randomGenerator.nextInt(300);
		}
		
		return input;
	}

}
